<template>
	<view class="conter">
		<!-- <header-box :title="title"></header-box> -->


		<view class="header" style="color: #000000;" @tap="goBack(id)">
			<view class="arrow">
			</view>
			<view class="title">
				{{title}}
			</view>
		</view>




		<view class="text-tab">
			<view class="box">
				<view class="marige-bor" v-for="(item, index) in textList" :key="index" @tap="skip(item)">
					<view class="diso-flex">
						<view class="">
							{{item.name}}
						</view>
						<view class="conter-image">
							<!-- <image src="../../static/index/right.png" mode=""></image> -->

							<u-radio-group v-model="value">
								<u-radio active-color="#AFB3F1" :name="item.id"></u-radio>
							</u-radio-group>
						</view>
					</view>
				</view>
			</view>
		</view>



		<view class="flex-box total">
			<view class="">
				合计：
			</view>
			<view class="">
				{{total}} 个
			</view>
		</view>

	</view>
</template>

<script>
	import headerBox from '../../components/header/header.vue'

	export default {
		components: {
			headerBox
		},
		data() {
			return {
				title: '往来单位',
				textList: [],
				addUrl: '',
				value: '',
				total: '',
				id: '',
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getList()
		},
		onShow() {

		},
		methods: {

			async getList() {
				const res = await this.$u.post("api/Company/index");
				this.textList = res.data
				this.total = res.data.length
				this.value = res.data[0].id
				console.log(res, this.total, '444444444')
			},


			goBack(id) {
				console.log(id)
				uni.navigateBack({
					delta: 1
				})





				let pages = getCurrentPages(); //获取所有页面栈实例列表
				let nowPage = pages[pages.length - 1]; //当前页页面实例
				let prevPage = pages[pages.length - 2]; //上一页页面实例
				prevPage.$vm.searchVal = this.value; //修改上一页data里面的searchVal参数值为1211
			},





			skip(item) {
				if (this.id == '3') {
					uni.navigateTo({
						url: '/pages/removeStock/tabList'
					})
				}
				
				console.log('00000000000', item)

			},
		}
	}
</script>

<style lang="scss" scoped>
	.conter {
		width: 100%;
		height: 100%;
		position: relative;



		.header {
			width: 100%;
			height: 150rpx;
			line-height: 150rpx;
			display: flex;
			align-items: center;
			// padding-left: 10rpx;
			padding-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			background: linear-gradient(to right, #656CE6, #9397FC);

			.arrow {
				position: relative;
				display: inline-block;
			}

			.arrow::before {
				content: '';
				width: 10px;
				height: 10px;
				border: 0px;
				border-bottom: solid 2px #fff;
				border-left: solid 2px #fff;
				-ms-transform: rotate(45deg);
				-webkit-transform: rotate(45deg);
				transform: rotate(45deg);
				position: absolute;
				top: 50%;
				left: 0;
				margin-top: -4px;
				margin-left: 28rpx;
			}

			.title {
				color: #fff;
				margin: 0 auto;
			}
		}






		image {
			width: 100%;
			height: 100%;
		}

		.text-tab {
			width: 100%;
			padding: 30rpx;
			padding-bottom: 0;


			.box {
				width: 98%;
				margin: 0 auto;
				background-color: #FFFFFF;
				border-radius: 10rpx;
			}

			.marige-bor {
				width: 90%;
				margin: 0 auto;
				color: #333333;
				display: flex;
				font-size: 28rpx;
				align-items: center;
				border-bottom: 1rpx solid #F0F0F0;
				justify-content: space-between;

				.diso-flex {
					width: 100%;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
				}

				.conter-image {
					width: 22rpx;
					height: 36rpx;
				}
			}

			.marige-bor:last-child {
				border-bottom: 0;
			}
		}


		.total {
			width: 100%;
			position: absolute;
			bottom: 0;
			left: 0;
			height: 100rpx;
			padding: 0 60rpx 0 30rpx;
			background-color: #FFFFFF;
		}

	}
</style>
